package observer;

import observer.ConcreteObserver.laoba;
import observer.ConcreteObserver.lisi;
import observer.ConcreteObserver.wangwu;
import observer.ConcreteSubjec.ZhangSan;
import observer.subject.Debit;

/**
 * 观察者模式
 */
public class Test {
    public static void main(String[] args) {

        Debit zhangsan = new ZhangSan();
        System.out.println("----张三没钱----");
        zhangsan.borrow(new lisi());
        System.out.println("张三找李四借钱！");
        zhangsan.borrow(new wangwu());
        System.out.println("张三找王五借钱！");
        zhangsan.borrow(new laoba());
        System.out.println("张三找老八借钱！");
        System.out.println("----张三有钱了----");
        zhangsan.notifyCredits();

    }

}